import React, {Component} from 'react';
import globalContext from '../context'

class B extends Component {
    getInfo(value){
        console.log('111',value)
        return (
            <div>
                {
                    <p>userName:{value.userName}</p>
                }
                {
                    <p>age:{value.age}</p>
                }
            </div>
        )
    }
    render() {
        const {Consumer} = globalContext
        return (
            <div>
                <h3>我是B组件</h3>
                <Consumer>
                    {
                        this.getInfo
                    }
                </Consumer>
            </div>
        );
    }
}

export default B;